<?php include('functions.php');
/*
if(change_perm != true) {

}
*/
clearstatcache($_GET['dir']);
$file = $_GET['file']; // get just the file name
$dir = $_GET['dir']; // lets find the file we are talking about
?>
<html>
<head>
<title>oPanel V<?php echo $ver; ?></title>
<link rel="shortcut icon" href="favicon.ico" />
<link rel="stylesheet"href="style.css">
<script>
function calcperm() {
        document.fmode.u.value = 0;
        if (document.fmode.ur.checked) {
                document.fmode.u.value = document.fmode.u.value * 1 + document.fmode.ur.value * 1;
        }
        if (document.fmode.uw.checked) {
                document.fmode.u.value = document.fmode.u.value * 1 + document.fmode.uw.value * 1;
        }
        if (document.fmode.ux.checked) {
                document.fmode.u.value = document.fmode.u.value * 1 + document.fmode.ux.value * 1;
        }
        document.fmode.g.value = 0;
        if (document.fmode.gr.checked) {
                document.fmode.g.value = document.fmode.g.value * 1 + document.fmode.gr.value * 1;
        }
        if (document.fmode.gw.checked) {
                document.fmode.g.value = document.fmode.g.value * 1 + document.fmode.gw.value * 1;
        }
        if (document.fmode.gx.checked) {
                document.fmode.g.value = document.fmode.g.value * 1 + document.fmode.gx.value * 1;
        }
        document.fmode.w.value = 0;
        if (document.fmode.wr.checked) {
                document.fmode.w.value = document.fmode.w.value * 1 + document.fmode.wr.value * 1;
        }
        if (document.fmode.ww.checked) {
                document.fmode.w.value = document.fmode.w.value * 1 + document.fmode.ww.value * 1;
        }
        if (document.fmode.wx.checked) {
                document.fmode.w.value = document.fmode.w.value * 1 + document.fmode.wx.value * 1;
        }
}               
</script>
</head>
<body onLoad="calcperm();">
<center><img src="images/logo.png"></center>
<form name="fmode" action="changeperm.php" method="post">
<?php echo $file; ?><br>
<table border=3>
   <tr><td><b>Mode</b></td><td>User</td><td>Group</td><td>World</td></tr>

   <tr><td>Read</td><td><input  type="checkbox" name="ur" value="4" onClick="calcperm();"></td><td><input  type="checkbox" name="gr"
   value="4" onClick="calcperm();"></td><td><input  type="checkbox" name="wr" value="4" onClick="calcperm();"></td></tr>
   <tr><td>Write</td><td><input  type="checkbox" name="uw" value="2" onClick="calcperm();"></td><td><input  type="checkbox" name="gw"
   value="2" onClick="calcperm();"></td><td><input  type="checkbox" name="ww" value="2" onClick="calcperm();"></td></tr>
   <tr><td>Execute</td><td><input  type="checkbox" name="ux" value="1" onClick="calcperm();"></td><td><input  type="checkbox" name="gx"
   value="1" onClick="calcperm();"></td><td><input  type="checkbox" name="wx" value="1" onClick="calcperm();"></td></tr>
   <tr><td>Permission</td><td><input type="text" name="u" size="1" onChange="recheck();"></td><td><input type="text" name="g" size="1" onChange="recheck();"></td><td><input type="text" name="w" size="1" onChange="recheck();"></td></tr>

</table>
<center>
<input type="submit" value="Change"></center>
<input type=hidden name="filename" value="<?php echo $file; ?>">

<input type=hidden name="dir" value="<?php echo $dir; ?>">
</form>
</body>
</html>